<script setup lang="ts">
import { useUserStore } from '@/stores/user'
import { reqToken } from '@/api/catApi'
import { ref } from 'vue'
const userStore = useUserStore()
const msg = ref('')
const getToken = async () => {
  let res = await reqToken()
  //const token = res.data.data
  console.log(res.data.data)
  //先固定下来
  const token = 'f6dd12b77c91704ec504edb707136d75'
  //更新仓库的token
  if(token){
    userStore.setToken(token)
  }
  msg.value = res.data.msg
}

</script>

<template>
<h>我是首页</h>
<p>{{ msg }}</p>
<p>当前token: {{ userStore.token }}</p>
<el-button @click="getToken()">获取新token</el-button>
</template>

<style scoped>

</style>
